<!DOCTYPE HTML>
<html lang="en">
<head>
  <meta name="copyright" content=
  "Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
  <meta charset="utf-8">
  <link rel="STYLESHEET" href="../book.css" type="text/css">
  <title>Compare Editor</title>
</head>
<body>
  <h1 class="Head">Compare Editor</h1>
  <p class="Para">You can view the differences between two files by comparing them. You can compare different files,
  you can compare versions in the Workbench with versions in the repository, or with the local edit history. In some
  cases you can compare three files (when a common ancestor exists).</p>
  <p class="Para">After a comparison is carried out, the compare editor opens in the editor area. In the compare
  editor, you can browse through all the differences and copy highlighted differences between the compared resources.
  You can save changes to resources that are made in the comparison editor.</p>
  <p class="Para">Compare editor allows for two kind of navigation: using differences or changes. A change is a portion
  of text that has been modified within the line, and the difference is a section of file consisting of one or more
  lines, and can contain many changes.</p>
  <p class="Para"><img src="../images/compare-editor-diff-change.png" alt="Differences and changes."></p>
  <p class="Para">Differences are marked with blue color, changes with red.</p>
  <p class="Para">Here is how the compare editor looks when you open it from a Workspace synchronization.</p>
  <p class="Para"><img src="../images/compare-editor.png" alt=
  "Picture of 3-paned editor. Top pane compares project structure; bottom 2 panes (side by side) compare lines of source."></p>
  <div class="Topic">
    <div class="Subtopic">
      <h2>Toolbar</h2>
      <p>The toolbar of the Compare editor includes the following buttons:</p>
      <dl>
        <dt>Switch Compare Viewer&nbsp;<img src="../images/view_menu.svg" alt=
        "Image of the 'Switch Compare Viewer' button"></dt>
        <dd>Basing on the content type the system determines which compare viewer should be used during a comparison.
        The button opens a drop down menu which allows to choose between other viewers registered for the same content
        type. If there is no alternative content viewer available the button is hidden.</dd>
        <dt>Control Visibility of Ancestor Pane&nbsp;<img src="../images/ancestorpane_co.svg" alt=
        "Image of the 'Control Visibility of Ancestor Pane' button"></dt>
        <dd>There are two conditions under which a three way compare will occur, both when using the version management
        support: when comparing a file that is in conflict, and when comparing a file being merged from a branch. In
        both cases, the system will determine a common ancestor in the repository to compare the conflict or merge
        against. This button determines the visibility of the third editor. By default, the ancestor pane is not
        visible.</dd>
        <dt>Perform Three way/Two way Compare&nbsp;<img src="../images/twowaycompare_co.svg" alt=
        "Image of the 'Perform Three way/Two way Compare' button"></dt>
        <dd>The compare editor can be toggled between performing a three way compare or a two way compare which ignores
        the common ancestor.</dd>
        <dt>Copy All from Left to Right&nbsp;<img src="../images/copy_r_co.svg" alt=
        "Image of the 'Copy All from Left to Right' button"></dt>
        <dd>Copies the entire contents of the file in the left pane into the file in the right pane, making the
        contents of the two files identical.</dd>
        <dt>Copy All Non-Conflicting Changes from Right to Left&nbsp;<img src="../images/copy_l_co.svg" alt=
        "Image of the 'Copy All Non-Conflicting Changes from Right to Left' button"></dt>
        <dd>Copies all the non-conflicting changes from the right pane into the left pane. Conflicting changes must be
        copied individually.</dd>
        <dt>Copy Current Change from Left to Right&nbsp;<img src="../images/copycont_r_co.svg" alt=
        "Image of the 'Copy Current Change from Left to Right' button"></dt>
        <dd>Merges changes in two files by copying the highlighted change in the left pane into the highlighted
        fragment on the right. This will overwrite the highlighted fragment in the right pane.</dd>
        <dt>Copy Current Change from Right to Left&nbsp;<img src="../images/copycont_l_co.svg" alt=
        "Image of the 'Copy Current Change from Right to Left' button"></dt>
        <dd>Does the opposite of the one just described.</dd>
        <dt>Select Next Difference&nbsp;<img src="../images/next_diff_nav.svg" alt=
        "Image of the 'Select Next Difference' button"></dt>
        <dd>Highlights the next difference that is found between the compared resources.</dd>
        <dt>Select Previous Difference&nbsp;<img src="../images/prev_diff_nav.svg" alt=
        "Image of the 'Select Previous Difference' button"></dt>
        <dd>Highlights the previous difference that is found between the compared resources.</dd>
        <dt>Select Next Change&nbsp;<img src="../images/next_change_nav.svg" alt=
        "Image of the 'Select Next Change' button"></dt>
        <dd>Highlights the next change that is found between the compared resources.</dd>
        <dt>Select Previous Change&nbsp;<img src="../images/prev_change_nav.svg" alt=
        "Image of the 'Select Previous Change' button"></dt>
        <dd>Highlights the previous change that is found between the compared resources.</dd>
      </dl>
      <h3 class="related">Related Concepts</h3>
      <a href="../concepts/concepts-29.htm">Three way comparisons</a>
      <h3 class="related">Related Tasks</h3><a href="../tasks/tasks-68.htm">Comparing resources</a><br>
      <a href="../tasks/tasks-115.htm">Synchronizing with the repository</a><br>
      <a href="../tasks/tasks-68dg.htm">Merging changes in the compare editor</a><br>
      <a href="../tasks/tasks-113b.htm">Resolving conflicts</a><br>
      <a href="../tasks/tasks-68b.htm">Setting preferences for comparing files</a><br>
      <a href="../tasks/tasks-101.htm">Comparing resources with repository versions</a>
    </div>
  </div>
</body>
</html>
